home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 9564 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.3 KB

  1. Path: ix.netcom.com!chi-il9-25
  2. From: stefmit@ix.netcom.com
  3. Newsgroups: comp.lang.c++
  4. Subject: [Q] Simple question about constructors
  5. Date: 2 Mar 1996 19:26:26 GMT
  6. Organization: Netcom
  7. Message-ID: <4ha7d2$quc@cloner4.netcom.com>
  8. NNTP-Posting-Host: chi-il9-25.ix.netcom.com
  9. X-NETCOM-Date: Sat Mar 02 11:26:26 AM PST 1996
  10. X-Newsreader: News Xpress Version 1.0 Beta #4
  11.  
  12. Trying to work/learn C++ from an old book, I got to a point where my 
  13. understanding stops: picking a sample constructor from another much 
  14. newer source, I came across a syntax in the form:
  15. class_name :: class_name (arguments) : data_member1 (argument1), data_member2 
  16. (argument2) {}
  17. The portion I don't know the meaning of (though I assume is kind of 
  18. intialization list, that would've appeared otherwise within {}, as far as I 
  19. learned from my book), is the portion after ":".
  20. I would kindly request some elaboration on this, especially concerning a 
  21. statement in the source where I found this, similar to: "this is the only way 
  22. the initialization can be done in some cases (!!!)". Does this mean I am not 
  23. always able to define a constructor the way I've learned so far (in its {} 
  24. body)?
  25. Thanks a lot for any suggestions, and please refrain from sending me to RTFM. 
  26. I have a manual I am using, and doesn't have this syntax. Neither I found it 
  27. in the FAQ for this group.
  28.